package com.cloudspace.jindun.model;

import com.cloudspace.jindun.dao.LoginUser;
import com.cloudspace.jindun.utils.ObjUtil;

import java.io.Serializable;

/**
 * Created by zengxianhua on 16/12/17.
 */

public class User implements Serializable{


    /**
     * status : 200
     * msg : OK
     * data : {"userPassnr":null,"userId":"100","userName":"李作松","userPassword":null,"iconUrl":null,"organId":null,"departmentId":null,"cloudToken":null,"sipAccout":null,"sipPassword":null,"userPhone":"192214543","userStatus":"0001","isCtrl":null}
     */

    private int status;
    private String msg;
    /**
     * userPassnr : null
     * userId : 100
     * userName : 李作松
     * userPassword : null
     * iconUrl : null
     * organId : null
     * departmentId : null
     * cloudToken : null
     * sipAccout : null
     * sipPassword : null
     * userPhone : 192214543
     * userStatus : 0001
     * isCtrl : null
     */

    private UserData data;

    public int getStatus() {
        return status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public UserData getData() {
        return data;
    }

    public void setData(UserData data) {
        this.data = data;
    }

    public static class UserData {
        private String userPassnr;
        private String userId;
        private String userName;
        private String userPassword;
        private String iconUrl;
        private String organId;
        private String departmentId;
        private String cloudToken;
        private String sipAccout;
        private String sipDomain;
        private String sipPassword;
        private String userPhone;
        private String userStatus;
        private String isCtrl;



        public static LoginUser generateDatabean(UserData bean){
            if (ObjUtil.isEmpty(bean)){
                return null;
            }

            LoginUser user = new LoginUser();
            user.setOrganId(bean.getOrganId());
            user.setUserName(bean.getUserName());
            user.setCloudToken(bean.getCloudToken());
            user.setIconUrl(bean.getIconUrl());
            user.setIsCtrl(bean.getIsCtrl());
            user.setSipAccout(bean.getSipAccout());
            user.setUserPhone(bean.getUserPhone());
            user.setUserStatus(bean.getUserStatus());
            user.setSipPassword(bean.getSipPassword());
            user.setUserPassnr(bean.getUserPassnr());
            user.setSipDomain(bean.getSipDomain());
            user.setUserId(bean.getUserId());
            user.setSipPassword(bean.getSipPassword());
            user.setDepartmentId(bean.getDepartmentId());
            return user;
        }

        public static UserData generateDatabean(LoginUser user){
            if (ObjUtil.isEmpty(user)){
                return null;
            }

            UserData bean = new UserData();
            bean.setOrganId(user.getOrganId());
            bean.setUserName(user.getUserName());
            bean.setCloudToken(user.getCloudToken());
            bean.setIconUrl(user.getIconUrl());
            bean.setIsCtrl(user.getIsCtrl());
            bean.setSipAccout(user.getSipAccout());
            bean.setUserPhone(user.getUserPhone());
            bean.setUserStatus(user.getUserStatus());
            bean.setSipPassword(user.getSipPassword());
            bean.setUserPassnr(user.getUserPassnr());
            bean.setSipDomain(user.getSipDomain());
            bean.setUserId(user.getUserId());
            bean.setSipPassword(user.getSipPassword());
            bean.setDepartmentId(user.getDepartmentId());
            return bean;
        }

        public String getUserPassnr() {
            return userPassnr;
        }

        public void setUserPassnr(String userPassnr) {
            this.userPassnr = userPassnr;
        }

        public String getUserId() {
            return userId;
        }

        public void setUserId(String userId) {
            this.userId = userId;
        }

        public String getUserName() {
            return userName;
        }

        public void setUserName(String userName) {
            this.userName = userName;
        }

        public String getUserPassword() {
            return userPassword;
        }

        public void setUserPassword(String userPassword) {
            this.userPassword = userPassword;
        }

        public String getIconUrl() {
            return iconUrl;
        }

        public void setIconUrl(String iconUrl) {
            this.iconUrl = iconUrl;
        }

        public String getOrganId() {
            return organId;
        }

        public void setOrganId(String organId) {
            this.organId = organId;
        }

        public String getDepartmentId() {
            return departmentId;
        }

        public void setDepartmentId(String departmentId) {
            this.departmentId = departmentId;
        }

        public String getCloudToken() {
            return cloudToken;
        }

        public void setCloudToken(String cloudToken) {
            this.cloudToken = cloudToken;
        }

        public String getSipAccout() {
            return sipAccout;
        }

        public void setSipAccout(String sipAccout) {
            this.sipAccout = sipAccout;
        }

        public String getSipPassword() {
            return sipPassword;
        }

        public void setSipPassword(String sipPassword) {
            this.sipPassword = sipPassword;
        }

        public String getUserPhone() {
            return userPhone;
        }

        public void setUserPhone(String userPhone) {
            this.userPhone = userPhone;
        }

        public String getUserStatus() {
            return userStatus;
        }

        public void setUserStatus(String userStatus) {
            this.userStatus = userStatus;
        }

        public String getIsCtrl() {
            return isCtrl;
        }

        public void setIsCtrl(String isCtrl) {
            this.isCtrl = isCtrl;
        }

        public String getSipDomain() {
            return sipDomain;
        }

        public void setSipDomain(String sipDomain) {
            this.sipDomain = sipDomain;
        }
    }
}
